/*
 * Copyright (c) 2006-2023, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-06-29     Rbb666       first version
 */

#include <rtthread.h>
#include <rtdevice.h>
#include "drv_gpio.h"

#define LED1_PIN     GET_PIN(0, 0)
#define LED2_PIN     GET_PIN(0, 1)
static char ssid[] = "Xiaomi13Pro";
static char key[] = "147258369";

int main(void)
{
    rt_err_t err;

    rt_uint32_t end;
    rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
    rt_pin_mode(LED2_PIN, PIN_MODE_OUTPUT);

    setup_init();
    rt_thread_mdelay(1000);

    err = rt_wlan_connect(ssid, key);
    if (err == RT_EOK)
    {
        mqtt_init();
    }

    for (;;)
    {
        rt_pin_write(LED1_PIN, PIN_HIGH);
        rt_thread_mdelay(500);
        rt_pin_write(LED1_PIN, PIN_LOW);
        rt_thread_mdelay(500);
    }
}
